﻿using UnityEngine;
using System.Collections;

public class PopupTextBox : MonoBehaviour {

	public GameObject label;

	public void Init(string txt){
		label.GetComponent<UILabel>().text = txt;
		Invoke ("StartTween", 1.0f);
	}

	void StartTween(){
		GetComponent<TweenAlpha> ().from = 1.0f;
		GetComponent<TweenAlpha> ().to = 0.0f;
		GetComponent<TweenAlpha> ().ResetToBeginning ();
		GetComponent<TweenAlpha> ().enabled = true;
	}
	public void OnTweenAlphaDone(){
		Destroy (gameObject);
	}
}
